package com.lzy.springbootredis.dao;

import com.lzy.springbootredis.entity.VideoDO;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.Map;

@Repository
public class VideoDao {

    private static Map<Integer, VideoDO> map = new HashMap<>();

    static {
        map.put(1, new VideoDO(1,"金项链","https://xdclass.net",1099));
        map.put(2,new VideoDO(2,"银项链","https://xdclass.net",688));
        map.put(3,new VideoDO(3,"金手镯","https://xdclass.net",1000));
        map.put(4,new VideoDO(4,"银手镯","https://xdclass.net",99));
        map.put(5,new VideoDO(5,"金戒指","https://xdclass.net",888));
        map.put(6,new VideoDO(6,"银戒指","https://xdclass.net",666));
    }


    /**
     * 模拟从数据库找
     * @param videoId
     * @return
     */
    public VideoDO findDetailById(int videoId) {
        return map.get(videoId);
    }
}
